package org.example.diet_compass.mapper;

import org.apache.ibatis.annotations.Select;
import org.example.diet_compass.domain.Scores;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
* @author 86135
* @description 针对表【scores(评分表)】的数据库操作Mapper
* @createDate 2025-03-04 08:04:21
* @Entity .domain.Scores
*/
public interface ScoresMapper extends BaseMapper<Scores> {

    @Select("select * from scores where user_id=#{userId} and goods_id = #{goodsId} ")
    Scores selectByGoodIdAndUserId(String goodsId, Integer userId);

    @Select("select score from scores where user_id = #{userId} and goods_id = #{goodsId}")
    Integer getScoreByGoodIdAndUserId(String goodsId, Integer userId);

    @Select("select count(score) from scores where goods_id = #{goodsId}")
    Integer getGoodScoreNums(String goodsId);
}




